set(TARGET VideoProcess)
# 设置外部库路径
# E:\OpenSourceLib\3rd\opencv\build\x64\vc16
# set(OPENCV_LIB_DIR "E:/OpenSourceLib/3rd/opencv/build/x64/vc16/lib")
# set(OPENCV_DLL_DIR "E:/OpenSourceLib/3rd/opencv/build/x64/vc16/bin")
# set(OPENCV_INCLUDE_DIR "E:/OpenSourceLib/3rd/opencv/build/include")
 
SET(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib") 
 


# 添加 OpenCV 库的头文件路径
# include_directories(${OPENCV_INCLUDE_DIR})
 
# # 链接 OpenCV 库
# target_link_libraries(VideoProcess PUBLIC
    # ${OPENCV_LIB_DIR}/opencv_world480d.lib
    # #Qt${QT_VERSION_MAJOR}::Core
# )
 
# # 将 OpenCV 的 DLL 文件复制到程序输出目录中
# add_custom_command(TARGET VideoProcess POST_BUILD
    # COMMAND ${CMAKE_COMMAND} -E copy_if_different
        # ${OPENCV_DLL_DIR}/opencv_world470.dll
        # $<TARGET_FILE_DIR:VideoProcess>
# )

FILE(GLOB SOURCE_FILES "./*.cpp")
FILE(GLOB HEAD_FILES "./*.h")


ADD_LIBRARY(VideoProcess SHARED ${HEAD_FILES} ${SOURCE_FILES})

# # 链接 OpenCV 库
# target_link_libraries(VideoProcess PUBLIC
    # # ${OPENCV_LIB_DIR}/opencv_world480d.lib
    # #Qt${QT_VERSION_MAJOR}::Core
# )

# 为共享库添加导出定义
# 对于 Windows 平台，使用 __declspec(dllexport) 来标记导出符号
if(WIN32)
  target_compile_definitions(VideoProcess PRIVATE VIDEO_PROCESS_LIB)
endif()

# 对于非 Windows 平台，使用 __attribute__((visibility("default"))) 来标记导出符号
if(NOT WIN32)
  set_target_properties(VideoProcess PROPERTIES CXX_VISIBILITY_PRESET hidden)
  set_target_properties(VideoProcess PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
  target_compile_options(VideoProcess PRIVATE -fvisibility=hidden)
endif()

# # 设置静态库输出路径
# # SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# # 设置动态库输出路径
# SET_TARGET_PROPERTIES(DemoDll PROPERTIES RUNTIME_OUTPUT_DIRECTORY ../bin)

set_target_properties(VideoProcess PROPERTIES FOLDER "services") #将此工程分类到文件夹中
# 为 Debug 和 Release 配置的库文件设置后缀
set_target_properties(VideoProcess PROPERTIES
  DEBUG_POSTFIX "_d"
  RELEASE_POSTFIX ""
)